package com.eleadmin.common.system.service.impl;

import java.util.List;

import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.eleadmin.common.core.web.PageParam;
import com.eleadmin.common.core.web.PageResult;
import com.eleadmin.common.system.entity.TaskType;
import com.eleadmin.common.system.mapper.TaskTypeMapper;
import com.eleadmin.common.system.param.TaskTypeParam;
import com.eleadmin.common.system.service.TaskTypeService;

/**
 * 订单类型表Service实现
 *
 * @author EleAdmin
 * @since 2025-04-22 22:55:28
 */
@Service
public class TaskTypeServiceImpl extends ServiceImpl<TaskTypeMapper, TaskType> implements TaskTypeService {

    @Override
    public PageResult<TaskType> pageRel(TaskTypeParam param) {
        PageParam<TaskType, TaskTypeParam> page = new PageParam<>(param);
        //page.setDefaultOrder("create_time desc");
        List<TaskType> list = baseMapper.selectPageRel(page, param);
        return new PageResult<>(list, page.getTotal());
    }

    @Override
    public List<TaskType> listRel(TaskTypeParam param) {
        List<TaskType> list = baseMapper.selectListRel(param);
        // 排序
        PageParam<TaskType, TaskTypeParam> page = new PageParam<>();
        //page.setDefaultOrder("create_time desc");
        return page.sortRecords(list);
    }

    @Override
    public TaskType getByIdRel(Integer id) {
        TaskTypeParam param = new TaskTypeParam();
        param.setId(id);
        return param.getOne(baseMapper.selectListRel(param));
    }

}
